class Solution {
public:
    vector<int> res;
    vector<vector<int>> ans;
    void dfs(int r,int n,int k){
      if(res.size()+n+1-r < k){
        return;
      }
      if(res.size() == k){
        ans.push_back(res);
        return;
      }
        res.push_back(r);
        dfs(r+1,n,k);

        res.pop_back();
        dfs(r+1,n,k);
    }
    vector<vector<int>> combine(int n, int k) {
      dfs(1,n,k);
      return ans;
    }
};
